import React from 'react';
import ProForm, {ModalForm, ProFormText} from "@ant-design/pro-form";
import {message} from "antd";
import {sendMember} from "@/services/ant-design-pro/users";

const SendMember = (props) => {
  const {isSend,setIsSend,actionRef,record} = props
  return (
    <div>
      <ModalForm
        visible={isSend}
        trigger={
          <h4>赠送会员</h4>
        }
        title='赠送会员'
        onVisibleChange={setIsSend}
        onFinish={async (values)=>{
          console.log(values);
          await sendMember(record,{...values})

          message.success('赠送成功！')
          setIsSend(false)
          actionRef.current?.reload();
        }}
      >
        <ProForm
          submitter={false}
        >
          <ProFormText
            label='赠送会员时长'
            name='member_time'
          />
        </ProForm>
      </ModalForm>
    </div>
  );
};

export default SendMember;
